<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>AJAX Login</title>
<script type="text/javascript" src="/lib/jquery-3.4.1.js"></script>
<script type="text/javascript">
	$(function(){
		$('#btn').click(function(){		
			var  strAcnt = $('#account').val();
			var  strPwd = $('#password').val();
			
			// $.get("url",[params], [function(){}] ) 参数3：回调函数 
			$.get("/ajax/login", {
						 //name:value
						 account:strAcnt,
						 password:strPwd
					 }, function(result){
						 console.log(result);
						 if(result.status == "1"){
							 window.location.href="/userManage_ajax/userList.html";
						 }else{					
							$('#ErrMsg').html("用户名或密码错误，请重新输入！");
						 }
					 });
			// $.post("url",params，function(){}) 对应method="post"
		})
	})
</script>
</head>
<body>
	<form>
		<p>用户名：<input type="text" id="account">
			<span style="color:red" id="ErrMsg"></span>
		</p>
		
		<p>密&nbsp&nbsp&nbsp码：<input type="text" id="password"></p>
		<p><input type="button" value="登录" id="btn"></p>
	</form>
</body>
</html>